// GlobalVars.h -- defines the Semaphores and global
// variables so that all can access them

#ifndef __GLOBAL_VAR_H__
#define __GLOBAL_VAR_H__

//includes
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Semaphore.h>
#include "bike_data.h"

/* ========= Semaphore ================ */
/* Semaphore handle defined in task.cfg */
// Semaphore used to control starting of the DisplayMain, DataMain
// WirlessMain and access to the data
extern const Semaphore_Handle DisplaySem; //Starting DisplayMain
extern const Semaphore_Handle DataSem;	  //Starting DataMain
extern const Semaphore_Handle WirelessSem;  //Starting WirelessMain
extern const Semaphore_Handle DataStrucSem; //Controlling access to the main data struc
extern const Semaphore_Handle TempDataSem;  //Controlling access to the tempary updates
extern const Semaphore_Handle RotarySem;    //Controlling access to Rotary state
extern const Semaphore_Handle UART0Sem;    //posted when a recieve happens from UART0
extern const Semaphore_Handle UART3Sem;    //posted when a recieve happens from UART3
extern const Semaphore_Handle ANTMesgSem; //Controlling access to the latest ANT Message
extern const Semaphore_Handle NewANTMesgSem; // Signal a New Message


/* ========= Global Variables ================ */

// Int used by timer handler to control starts
volatile int DisplayCount;
volatile int DataCount;
volatile int WirelessCount;

// The main Data Structure
BikeData BikeDataStruc;

// Temporary data storage
int Speed, Cadence;
int HeartRate = 0;
int updateWheelCount = 0;
int updatePedalCount = 0;
int updateHeartCount = 0;
char alertByte = 0;
int Screen = 1;

#endif //__GLOBAL_VAR_H__

